//
//  LSZTaskInformViewController.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/10/27.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZTaskInformViewController.h"

@interface LSZTaskInformViewController ()<UITableViewDelegate,UITableViewDataSource>
//@property(nonatomic,strong) UIBarButtonItem *anotherButton;
//@property(nonatomic,strong) UIView * viewChoose ;
@property(nonatomic,strong) UITableView * tableViewTaskInformView;
@property(nonatomic,strong) LSZIndustryManager * industryManager;
@end

@implementation LSZTaskInformViewController
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"任务通知";
    [self getData];
    [self.tableViewTaskInformView registerClass:[LSZNoticeTableViewCell class] forCellReuseIdentifier:@"LSZNoticeTableViewCell"];
}
-(void)getData
{
    [LSZRequestDicData initGetNotificationList:self.type :^(BOOL isOK, NSString * string, LSZIndustryManager * industryManager) {
        if (isOK == YES) {
            self.industryManager = industryManager;
            [self.tableViewTaskInformView reloadData];
        }else{
            if ([string isEqualToString:@"重复登录"]) {
                [LSZPublicClassDataToll RepeatLoginInterfaceJump:self.view fromVC:@"LSZLiteratureViewController"];
            }else{
                [LSZPublicClassDataToll initWithAlertKuangView:self.view string:string];
            }
        }
    }];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 100;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return  self.industryManager.arrayData.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.001;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LSZNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZNoticeTableViewCell" forIndexPath:indexPath];
    if (self.industryManager.arrayData.count >indexPath.row) {
        LSZIndustryMg * mg = nil;
        mg = self.industryManager.arrayData[indexPath.row];
        cell.industryMg = mg;
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.industryManager.arrayData.count >indexPath.row) {
        LSZIndustryMg * mg = nil;
        mg = self.industryManager.arrayData[indexPath.row];
        LSZInformTheDetailsViewController * vc = [[LSZInformTheDetailsViewController alloc]init];
        vc.industryMg = mg;
        [self.navigationController pushViewController:vc animated:YES];
    }
}
-(UITableView *)tableViewTaskInformView
{
    if (_tableViewTaskInformView == nil) {
        _tableViewTaskInformView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width , [[UIScreen mainScreen] bounds].size.height-NAVIGATION_BAR_HEIGHT-44) style:UITableViewStyleGrouped];
        _tableViewTaskInformView.delegate = self;
        _tableViewTaskInformView.dataSource = self;
        _tableViewTaskInformView.estimatedRowHeight=0;
        _tableViewTaskInformView.estimatedSectionFooterHeight =0;
        _tableViewTaskInformView.estimatedSectionHeaderHeight =0;
        [_tableViewTaskInformView setSeparatorInset:UIEdgeInsetsMake(0, 20, 0, 20)];
        [self.view addSubview:_tableViewTaskInformView
         ];
    }
    return _tableViewTaskInformView;
}
/*
 -(void)initWithViewChoose
 {
 self.viewChoose = [[UIView alloc]initWithFrame:CGRectMake(ScreenWidth-90,NAVIGATION_BAR_HEIGHT, 90, 120)];
 self.viewChoose.hidden = YES;
 self.viewChoose.backgroundColor = [UIColor whiteColor];
 [self.view addSubview:self.viewChoose];
 
 UIView * labelLineOne = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0.3, self.viewChoose.frame.size.height)];
 labelLineOne.backgroundColor = lightColor;
 [self.viewChoose addSubview:labelLineOne];
 
 UIView * labelLineTwo = [[UIView alloc]initWithFrame:CGRectMake(0,self.viewChoose.frame.size.height-0.2, self.viewChoose.frame.size.width,0.2)];
 labelLineTwo.backgroundColor = lightColor;
 [self.viewChoose addSubview:labelLineTwo];
 
 UILabel * labelOne = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, self.viewChoose.frame.size.width-10, self.viewChoose.frame.size.height/3)];
 labelOne.textColor = titleColorLSZ;
 labelOne.font = FONT_(14);
 labelOne.text = @"全部";
 [self.viewChoose addSubview:labelOne];
 [labelOne tapGesture:^(UIGestureRecognizer *ges) {
 [self categorySelectionDisplay:0];
 }];
 
 UILabel * labelTwo = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(labelOne.frame), self.viewChoose.frame.size.width-10, self.viewChoose.frame.size.height/3)];
 labelTwo.textColor = titleColorLSZ;
 labelTwo.font = FONT_(14);
 labelTwo.text = @"已经反馈";
 [self.viewChoose addSubview:labelTwo];
 [labelTwo tapGesture:^(UIGestureRecognizer *ges) {
 [self categorySelectionDisplay:1];
 }];
 
 UILabel * labelThree = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(labelTwo.frame), self.viewChoose.frame.size.width-10, self.viewChoose.frame.size.height/3)];
 labelThree.textColor = titleColorLSZ;
 labelThree.font = FONT_(14);
 labelThree.text = @"只显示未读";
 labelThree.numberOfLines = 0;
 [self.viewChoose addSubview:labelThree];
 [labelThree tapGesture:^(UIGestureRecognizer *ges) {
 [self categorySelectionDisplay:2];
 }];
 
 UIView * labelLineThree = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(labelOne.frame)-0.5, labelOne.frame.size.width-10,0.5)];
 labelLineThree.backgroundColor = lightColor;
 [labelOne addSubview:labelLineThree];
 
 UIView * labelLineFour = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(labelOne.frame)-0.5, labelTwo.frame.size.width-10,0.5)];
 labelLineFour.backgroundColor = lightColor;
 [labelTwo addSubview:labelLineFour];
 }
 //分类选择
 -(void)registerClick
 {
 self.viewChoose.hidden = NO;
 }
 -(void)categorySelectionDisplay:(NSInteger)number
 {
 self.viewChoose.hidden = YES;
 NSLog(@"选择的是那个%ld>>>>number",number);
 if (number == 1) {
 [self.anotherButton setTitle:@"已经反馈"];
 }else if (number == 2){
 [self.anotherButton setTitle:@"只显示未读"];
 
 }else{
 [self.anotherButton setTitle:@"全部"];
 }
 }
 */
@end
